package com.neutech.neusys.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.neutech.neusys.service.ConstantTypeService;
import com.neutech.po.ConstantType;


@RestController
@CrossOrigin("http://localhost:8081")
@RequestMapping("/neusys/constantType")
public class ConstantTypeController {
	@Autowired
	private ConstantTypeService constantTypeService;
	
	/* 查询常数类别 */
	@RequestMapping(value = "/find")
	public List<com.neutech.po.ConstantType> findall() {
		List<ConstantType> consList = constantTypeService.findall();
		return consList;
	}

	/* 模糊查询常数类别 */
	@RequestMapping(value = "/some")
	public List<ConstantType> selectsome(String name) {
		List<ConstantType> cons_someList = constantTypeService.selectsome(name);
		return cons_someList;
	}
	
	/* 增加常数类别 */
	@RequestMapping(value = "/addconstantTypea", method = RequestMethod.POST)
	public String addNewConstantType(ConstantType addconstantType) {
		int result = constantTypeService.addConstantType(addconstantType);
		if (result == 1) {
			return "success";
		} else {
			return "error";
		}
	}
}
